<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数组</title>
</head>
<body>
    <div id="box">

    </div>
        <script>

          var img =[                                    //建立一个数组
              'img/1.jpg',
                'img/2.jpg',
                'img/3.jpg',
                'img/4.jpg',
                'img/5.jpg'
          ];

          var boxObj = document.getElementById('box');
          var s = '';
          for (var aa in img){
//              boxObj.innerHTML = boxObj.innerHTML + '<img src="'+ img[aa] +'">';
              s = s + '<img src="'+ img[aa] +'">';
          }

          boxObj.innerHTML = s;

        </script>



</body>
</html>